﻿<%@ Application Language="C#" %>

<script runat="server">

    void Application_Start(object sender, EventArgs e) 
    {
        // Code that runs on application startup
        Application["Hits"] = 0;
    }
   
    void Application_BeginRequest(Object Sender, EventArgs e)
 {
   Application.Lock();
   int a = (int)Application["Hits"] + 1;
   Application["Hits"] = (int) Application["Hits"] + 1;
   Application.UnLock();
 }

    void Application_End(object sender, EventArgs e) 
    {
        //  Code that runs on application shutdown

    }
    string btnGoBack = "<br/><br/><input id=\"btnBack\" type=\"button\" value=\"Back\" onclick=\"history.back()\"/>";
 /*
    void Application_Error(object sender, EventArgs e) 
    { 
        // Code that runs when an unhandled error occurs
            Exception ex = Server.GetLastError();
            if (ex is HttpRequestValidationException)
            {
                string resMsg = "<html><body><span style=\"font-size: 14pt; color: red\">" +
                     "Komentārs ko ievadījāt satur skriptus kas nav atļauti, rakstiet vēlreiz bet bez html,xml.utt skritpiem<br />" +
                     btnGoBack +
                     "<br /></span></body></html>";
                Response.Write(resMsg);
                Response.StatusCode = 200;
                Response.End();
                
            }
        
    }
    */
    void Session_Start(object sender, EventArgs e) 
    {
        // Code that runs when a new session is started
    }

    void Session_End(object sender, EventArgs e) 
    {
        // Code that runs when a session ends. 
        // Note: The Session_End event is raised only when the sessionstate mode
        // is set to InProc in the Web.config file. If session mode is set to StateServer 
        // or SQLServer, the event is not raised.

    }
       
</script>
